/**
 * Created by qianxin on 17/6/1.
 * 屏幕工具类
 * ui设计基准,iphone 6
 * width:750
 * height:1334
 */
let ReactNative = require('react-native');
// 获取屏幕的dp
let Dimensions = require('Dimensions');
let screenW = Dimensions.get('window').width;
let screenH = Dimensions.get('window').height;

// 高保真的宽度和高度 pt
const designWidth = 375.0;
const designHeight = 667.0;

/**
 * 设置text
 * @param size  pt
 * @returns {Number} dp
 */
export function scaleSizeFont(size) {
  var scaleWidth = screenW / designWidth;
  var scaleHeight = screenH / designHeight;
  var scale = Math.min(scaleWidth, scaleHeight);
  size = Math.round(size * scale);
  return size;
}

/**
 * 设置高度
 * @param size  px
 * @returns {Number} dp
 */
export function scaleSizeH(size) {
  var scaleHeight = (size * screenH) / designHeight;
  size = Math.round(scaleHeight);
  return size;
}

/**
 * 设置宽度
 * @param size  px
 * @returns {Number} dp
 */
export function scaleSizeW(size) {
  var scaleWidth = (size * screenW) / designWidth;
  size = Math.round(scaleWidth);
  return size;
}
